package cn.com.ddapp.ddm.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import cn.com.ddapp.ddm.R;

/**
 * Created by Administrator on 2016/8/29.
 */
public class PayGridViewAdapter extends BaseAdapter {

    private Context context;
    private List<String> list;

    public PayGridViewAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView==null){
            convertView = LayoutInflater.from(context).inflate(R.layout.item_pay_gridview,parent,false);
        }
        TextView price = (TextView) convertView.findViewById(R.id.tv_price);
        price.setText(list.get(position));
        return convertView;
    }
}
